package com.dronff.handler;


import com.dronff.listener.ConnectSuccessListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpContentDecoder;
import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.codec.http.HttpServerCodec;
import org.apache.log4j.Logger;

public class TangRPCInvokerChannelInitializer extends ChannelInitializer<SocketChannel> {
    static final Logger logger = Logger.getLogger(ConnectSuccessListener.class);

    @Override
    protected void initChannel(SocketChannel channel) throws Exception {
        channel.pipeline()
                .addLast(
                        new ProtocolSelectHandler()
                )
                .addLast(
                        new TangProtocolInvokerInboundHandler()
                )
//                .addLast(
//                        new HttpServerCodec()
//                )
                .addLast(
                        new TangProtocolInvokerOutboundHandler()
                );
    }
}
